package main

import (
	"time"
	"fmt"
)

func doWork(id int, in <-chan int) {
	go func() {
		for {
			fmt.Printf("id=%d,num=%c \n", id, <-in)
		}
	}()
}

func createWorker(id int) chan<- int {
	ch := make(chan int)
	doWork(id, ch)
	return ch
}

func sendDemo() {
	chs := [10]chan<- int{}
	for i := 0; i < 10; i++ {
		chs[i] = createWorker(i)
	}
	for i, ch := range chs {
		ch <- 'a' + i
	}
	for i, ch := range chs {
		ch <- 'A' + i
	}
	time.Sleep(time.Millisecond)
}

func main() {
	sendDemo()
}
